{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.model_selection import train_test_split\n",
    "from keras.models import Model, load_model\n",
    "from keras.layers import Input, Dense\n",
    "np.random.seed(8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     mpg  cyl   disp   hp    drat       wt     qsec  vs  am  gear  carb  ID\n",
      "4   18.7    8  360.0  175    3.15    3.440    17.02   0   0     3     2   5\n",
      "16  14.7    8  440.0  230    3.23    5.345    17.42   0   0     3     4  17\n",
      "5   18.1    6  225.0  105    2.76    3.460    20.22   1   0     3     1   6\n",
      "13  15.2    8  275.8  180    3.07    3.780    18.00   0   0     3     3  14\n",
      "11  16.4    8  275.8  180    3.07    4.070    17.40   0   0     3     3  12\n",
      "23  13.3    8  350.0  245    3.73    3.840    15.41   0   0     3     4  24\n",
      "1   21.0    6  160.0  110    3.90    2.875    17.02   0   1     4     4   2\n",
      "2   22.8    4  108.0   93    3.85    2.320    18.61   1   1     4     1   3\n",
      "26  26.0    4  120.3   91    4.43    2.140    16.70   0   1     5     2  27\n",
      "3   21.4    6  258.0  110    3.08    3.215    19.44   1   0     3     1   4\n",
      "21  15.5    8  318.0  150    2.76    3.520    16.87   0   0     3     2  22\n",
      "27  30.4    4   95.1  113    3.77    1.513    16.90   1   1     5     2  28\n",
      "22  15.2    8  304.0  150    3.15    3.435    17.30   0   0     3     2  23\n",
      "18  80.4   10   75.7  100    4.93    1.615   150.52   1   1     4     2  19\n",
      "31  21.4    4  121.0  109    4.11    2.780    18.60   1   1     4     2  32\n",
      "20  21.5    4  120.1   97    3.70    2.465    20.01   1   0     3     1  21\n",
      "7   24.4    4  146.7   62    3.69    3.190    20.00   1   0     4     2   8\n",
      "10  17.8    6  167.6  210  800.00  900.000  1000.00   1   0     4     4  11\n",
      "14  10.4    8  472.0  205    2.93    5.250    17.98   0   0     3     4  15\n",
      "28  15.8    8  351.0  264    4.22    3.170    14.50   0   1     5     4  29\n",
      "19  33.9    4   71.1   65    4.22    1.835    19.90   1   1     4     1  20\n",
      "6   14.3    8  360.0  245    3.21    3.570    15.84   0   0     3     4   7\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(22, 12)"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# load autodesign\n",
    "auto_data = pd.read_csv('data/auto_design.csv')\n",
    "# split into input (X) and output (Y) variables\n",
    "X =auto_data.drop('Unnamed: 0', 1)\n",
    "from sklearn.model_selection import train_test_split\n",
    " \n",
    "X_train, X_test  = train_test_split(X, test_size=0.3, random_state=42)\n",
    "print(X_train)\n",
    "X_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "input_dim = X_train.shape[1]\n",
    "encoding_dim = 12\n",
    "input_layer = Input(shape=(input_dim, ))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [],
   "source": [
    "encoded = Dense(encoding_dim, activation='relu')(input_layer)\n",
    "decoded = Dense(12, activation='linear')(encoded)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [],
   "source": [
    "# this model maps an input to its reconstruction\n",
    "autoencoder = Model(input_layer, decoded)\n",
    "autoencoder.compile(optimizer='adadelta', loss='mse')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/100\n",
      "22/22 [==============================] - 0s - loss: 28985.7149     \n",
      "Epoch 2/100\n",
      "22/22 [==============================] - 0s - loss: 28571.5341     \n",
      "Epoch 3/100\n",
      "22/22 [==============================] - 0s - loss: 28183.4400     \n",
      "Epoch 4/100\n",
      "22/22 [==============================] - 0s - loss: 27798.2921     \n",
      "Epoch 5/100\n",
      "22/22 [==============================] - 0s - loss: 27422.6434     \n",
      "Epoch 6/100\n",
      "22/22 [==============================] - 0s - loss: 27080.4889    \n",
      "Epoch 7/100\n",
      "22/22 [==============================] - 0s - loss: 26722.0817     \n",
      "Epoch 8/100\n",
      "22/22 [==============================] - 0s - loss: 26391.1487     \n",
      "Epoch 9/100\n",
      "22/22 [==============================] - 0s - loss: 26058.9774     \n",
      "Epoch 10/100\n",
      "22/22 [==============================] - 0s - loss: 25679.5051     \n",
      "Epoch 11/100\n",
      "22/22 [==============================] - 0s - loss: 25321.6319     \n",
      "Epoch 12/100\n",
      "22/22 [==============================] - 0s - loss: 25028.8053     \n",
      "Epoch 13/100\n",
      "22/22 [==============================] - 0s - loss: 24725.8801     \n",
      "Epoch 14/100\n",
      "22/22 [==============================] - 0s - loss: 24429.5776    \n",
      "Epoch 15/100\n",
      "22/22 [==============================] - 0s - loss: 24119.8309     \n",
      "Epoch 16/100\n",
      "22/22 [==============================] - 0s - loss: 23821.7314    \n",
      "Epoch 17/100\n",
      "22/22 [==============================] - 0s - loss: 23405.2785    \n",
      "Epoch 18/100\n",
      "22/22 [==============================] - 0s - loss: 23008.8472     \n",
      "Epoch 19/100\n",
      "22/22 [==============================] - 0s - loss: 22612.7789     \n",
      "Epoch 20/100\n",
      "22/22 [==============================] - 0s - loss: 22209.7112    \n",
      "Epoch 21/100\n",
      "22/22 [==============================] - ETA: 0s - loss: 5731.38 - 0s - loss: 21800.5909    \n",
      "Epoch 22/100\n",
      "22/22 [==============================] - 0s - loss: 21388.8907    \n",
      "Epoch 23/100\n",
      "22/22 [==============================] - 0s - loss: 20967.3060    \n",
      "Epoch 24/100\n",
      "22/22 [==============================] - 0s - loss: 20561.8806     \n",
      "Epoch 25/100\n",
      "22/22 [==============================] - 0s - loss: 20138.5809    \n",
      "Epoch 26/100\n",
      "22/22 [==============================] - 0s - loss: 19727.7001     \n",
      "Epoch 27/100\n",
      "22/22 [==============================] - 0s - loss: 19316.7735    \n",
      "Epoch 28/100\n",
      "22/22 [==============================] - 0s - loss: 18910.6533    \n",
      "Epoch 29/100\n",
      "22/22 [==============================] - 0s - loss: 18507.9294    \n",
      "Epoch 30/100\n",
      "22/22 [==============================] - 0s - loss: 18077.0883     \n",
      "Epoch 31/100\n",
      "22/22 [==============================] - 0s - loss: 17661.9670     \n",
      "Epoch 32/100\n",
      "22/22 [==============================] - 0s - loss: 17247.4545     \n",
      "Epoch 33/100\n",
      "22/22 [==============================] - 0s - loss: 16823.1296    \n",
      "Epoch 34/100\n",
      "22/22 [==============================] - 0s - loss: 16396.0487    \n",
      "Epoch 35/100\n",
      "22/22 [==============================] - 0s - loss: 15975.9920     \n",
      "Epoch 36/100\n",
      "22/22 [==============================] - 0s - loss: 15533.9082    \n",
      "Epoch 37/100\n",
      "22/22 [==============================] - 0s - loss: 15120.2035    \n",
      "Epoch 38/100\n",
      "22/22 [==============================] - 0s - loss: 14688.9437     \n",
      "Epoch 39/100\n",
      "22/22 [==============================] - 0s - loss: 14293.1493    \n",
      "Epoch 40/100\n",
      "22/22 [==============================] - 0s - loss: 13901.4613    \n",
      "Epoch 41/100\n",
      "22/22 [==============================] - 0s - loss: 13512.3046     \n",
      "Epoch 42/100\n",
      "22/22 [==============================] - 0s - loss: 13120.1314    \n",
      "Epoch 43/100\n",
      "22/22 [==============================] - 0s - loss: 12703.2302     \n",
      "Epoch 44/100\n",
      "22/22 [==============================] - ETA: 0s - loss: 4062.12 - 0s - loss: 12360.8938    \n",
      "Epoch 45/100\n",
      "22/22 [==============================] - 0s - loss: 12025.0252    \n",
      "Epoch 46/100\n",
      "22/22 [==============================] - 0s - loss: 11716.7286    \n",
      "Epoch 47/100\n",
      "22/22 [==============================] - 0s - loss: 11423.5160    \n",
      "Epoch 48/100\n",
      "22/22 [==============================] - 0s - loss: 11136.2527    \n",
      "Epoch 49/100\n",
      "22/22 [==============================] - 0s - loss: 10850.6201    \n",
      "Epoch 50/100\n",
      "22/22 [==============================] - 0s - loss: 10567.9631     \n",
      "Epoch 51/100\n",
      "22/22 [==============================] - 0s - loss: 10303.0114    \n",
      "Epoch 52/100\n",
      "22/22 [==============================] - 0s - loss: 10059.0338     \n",
      "Epoch 53/100\n",
      "22/22 [==============================] - 0s - loss: 9823.7696     \n",
      "Epoch 54/100\n",
      "22/22 [==============================] - 0s - loss: 9590.7637     \n",
      "Epoch 55/100\n",
      "22/22 [==============================] - 0s - loss: 9378.6795     \n",
      "Epoch 56/100\n",
      "22/22 [==============================] - 0s - loss: 9174.2857     \n",
      "Epoch 57/100\n",
      "22/22 [==============================] - 0s - loss: 8986.4023     \n",
      "Epoch 58/100\n",
      "22/22 [==============================] - 0s - loss: 8755.8723     \n",
      "Epoch 59/100\n",
      "22/22 [==============================] - 0s - loss: 8586.1808      \n",
      "Epoch 60/100\n",
      "22/22 [==============================] - 0s - loss: 8427.5087    \n",
      "Epoch 61/100\n",
      "22/22 [==============================] - 0s - loss: 8240.4228    \n",
      "Epoch 62/100\n",
      "22/22 [==============================] - 0s - loss: 8058.5246    \n",
      "Epoch 63/100\n",
      "22/22 [==============================] - 0s - loss: 7890.0187    \n",
      "Epoch 64/100\n",
      "22/22 [==============================] - 0s - loss: 7768.9032    \n",
      "Epoch 65/100\n",
      "22/22 [==============================] - 0s - loss: 7658.9645     \n",
      "Epoch 66/100\n",
      "22/22 [==============================] - 0s - loss: 7550.8589    \n",
      "Epoch 67/100\n",
      "22/22 [==============================] - 0s - loss: 7451.3649     \n",
      "Epoch 68/100\n",
      "22/22 [==============================] - 0s - loss: 7351.2278     \n",
      "Epoch 69/100\n",
      "22/22 [==============================] - 0s - loss: 7256.8512     \n",
      "Epoch 70/100\n",
      "22/22 [==============================] - 0s - loss: 7159.8937    \n",
      "Epoch 71/100\n",
      "22/22 [==============================] - 0s - loss: 7071.1485    \n",
      "Epoch 72/100\n",
      "22/22 [==============================] - 0s - loss: 6987.5778    \n",
      "Epoch 73/100\n",
      "22/22 [==============================] - 0s - loss: 6873.3750    \n",
      "Epoch 74/100\n",
      "22/22 [==============================] - 0s - loss: 6796.6822    \n",
      "Epoch 75/100\n",
      "22/22 [==============================] - 0s - loss: 6723.5453      \n",
      "Epoch 76/100\n",
      "22/22 [==============================] - 0s - loss: 6653.9277    \n",
      "Epoch 77/100\n",
      "22/22 [==============================] - 0s - loss: 6585.6454    \n",
      "Epoch 78/100\n",
      "22/22 [==============================] - 0s - loss: 6519.3008     \n",
      "Epoch 79/100\n",
      "22/22 [==============================] - 0s - loss: 6454.6207    \n",
      "Epoch 80/100\n",
      "22/22 [==============================] - 0s - loss: 6388.0862    \n",
      "Epoch 81/100\n",
      "22/22 [==============================] - 0s - loss: 6325.4383    \n",
      "Epoch 82/100\n",
      "22/22 [==============================] - 0s - loss: 6261.7678      \n",
      "Epoch 83/100\n",
      "22/22 [==============================] - 0s - loss: 6200.4611      \n",
      "Epoch 84/100\n",
      "22/22 [==============================] - 0s - loss: 6138.7464      \n",
      "Epoch 85/100\n",
      "22/22 [==============================] - 0s - loss: 6079.2648    \n",
      "Epoch 86/100\n",
      "22/22 [==============================] - 0s - loss: 6020.7098    \n",
      "Epoch 87/100\n",
      "22/22 [==============================] - 0s - loss: 5961.9381    \n",
      "Epoch 88/100\n",
      "22/22 [==============================] - 0s - loss: 5904.7427    \n",
      "Epoch 89/100\n",
      "22/22 [==============================] - ETA: 0s - loss: 347.524 - 0s - loss: 5847.2705    \n",
      "Epoch 90/100\n",
      "22/22 [==============================] - 0s - loss: 5790.8529    \n",
      "Epoch 91/100\n",
      "22/22 [==============================] - 0s - loss: 5736.2226    \n",
      "Epoch 92/100\n",
      "22/22 [==============================] - 0s - loss: 5655.0846      \n",
      "Epoch 93/100\n",
      "22/22 [==============================] - 0s - loss: 5606.2881    \n",
      "Epoch 94/100\n",
      "22/22 [==============================] - 0s - loss: 5558.9952    \n",
      "Epoch 95/100\n",
      "22/22 [==============================] - 0s - loss: 5510.0380    \n",
      "Epoch 96/100\n",
      "22/22 [==============================] - 0s - loss: 5462.4612      \n",
      "Epoch 97/100\n",
      "22/22 [==============================] - 0s - loss: 5415.4355    \n",
      "Epoch 98/100\n",
      "22/22 [==============================] - 0s - loss: 5367.3071    \n",
      "Epoch 99/100\n",
      "22/22 [==============================] - 0s - loss: 5319.4265      \n",
      "Epoch 100/100\n",
      "22/22 [==============================] - 0s - loss: 5271.8252    \n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x1206a2c18>"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train = np.array(X_train)\n",
    "autoencoder.fit(X_train, X_train,epochs=100,batch_size=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "predictions = autoencoder.predict(X_train)\n",
    "mse = np.mean(np.power(X_train - predictions, 2), axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x120a00ef0>]"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAD3CAYAAADyvkg2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH/5JREFUeJzt3X+MJOV95/F39Y/p7vm1zLKzYM7YG+D4xraCDURmE4NB\nCjaG5A4rOp9OVnLOWeEMQsJ3suLI9qLEJ05WLJuTuTvDaS8W2GDpFBJLJ04YlEuMl3Uwik1yYPBD\n+OWfEE/210z3dE9Xd9f9UVU9PbM909M1PTNVM5+XtNvd1dU1T9f01Kef56nnKS8IAkRERAByO10A\nERFJD4WCiIh0KRRERKRLoSAiIl0KBRER6SrsdAE2a25uIfHpUzMz45w6tTjK4uw62kfr0/4ZTPto\nfTu1f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GZoA7zSzu\nW/g4cE9aPkOaOltERLr2avORiIj0oVAQEZEuhYKIiHQpFEREpEuhICIiXQoFERHpUiiIiEjX/wcp\n+PuyKnx3XQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1202f9b70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(mse)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'numpy.ndarray' object has no attribute 'loc'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-42-a1a6672f0a4b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mX_train_1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mX_train\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloc\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mX_train\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'mse'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m>\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m: 'numpy.ndarray' object has no attribute 'loc'"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
